﻿@inject IStringLocalizer<CheckboxListVertical> Localizer

<CheckboxList @bind-Value="@Dummy.Name" IsVertical="true" ShowBorder="false" Items="@Items" />

@code {
    /// <summary>
    /// Foo 类为Demo测试用，如有需要请自行下载源码查阅
    /// Foo class is used for Demo test, please download the source code if necessary
    /// https://gitee.com/LongbowEnterprise/BootstrapBlazor/blob/main/src/BootstrapBlazor.Shared/Data/Foo.cs
    /// </summary>
    private Foo Dummy { get; set; } = new Foo();

    [NotNull]
    private IEnumerable<SelectedItem>? Items { get; set; }

    /// <summary>
    /// OnInitialized method
    /// </summary>
    protected override void OnInitialized()
    {
        base.OnInitialized();

        Items = new List<SelectedItem>(new List<SelectedItem>
        {
            new SelectedItem { Text = Localizer["item1"], Value = Localizer["item1"] },
            new SelectedItem { Text = Localizer["item2"], Value = Localizer["item2"] },
            new SelectedItem { Text = Localizer["item3"], Value = Localizer["item3"] },
            new SelectedItem { Text = Localizer["item4"], Value = Localizer["item4"] },
        });

        Dummy = new Foo() { Name = Localizer["Foo"] };
    }
}
